<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>提现</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css"/>
		<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
		<link rel="stylesheet" href="__INDEX__/css/mall.css" />
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">提现</h1>
		</header>
		<div class="mui-content">
		    <div class="tixian_bank" id="card_list">
		    		<div class="tixian_bankimg"><img src="__INDEX__/images/yinlian.gif"></div>
		    		<div class="tixian_bankinfo">
		    			<p class="tix_banknum " ><em id='bank_name'>{$member_verif['bank_name']}</em></p>
		    			<p class="tix_banknum " ><em id='bank_num'>{$member_verif['bank_no']}</em></p>
		    		</div>
		    		<div class="clearfix"></div>
		    </div>
		    
		    <div class="tixian_pri">
		    	<p>提现金额</p>
		    	<p class="tixian_prinum clearfix">
		    		<label>¥</label>
		    		<input type="text" id="tixian_money" onkeyup="tx()" placeholder="" />
		    	</p>
		    	<p class="tixian_yue" >可用余额<span id="yue">{$info_user['balance']}</span> 元&nbsp;&nbsp;&nbsp;（单笔最大可提现额20000元）</p>
		    </div>
		    <div class="pay_paystyle">
		    	
		    <!--	<div class="tixian_bank">
					<b><p style="color:black;font-size: 12px;">手续费：<span id="shouxufei"></span></p></b>
					<b><p style="color:black;font-size: 12px;">实际到账：<span id="daozhang"></span></p></b>
				</div>-->
				
		     	<div class="tixian_bt">提现通道</div>
				<form class="mui-input-group">
					<!--<div class="mui-input-row mui-radio">
						<label>D+0</label>
						<input name="type" value="1" id="fs1" type="radio" checked>
					</div>-->
					<div class="mui-input-row mui-radio">
						<label>D+1</label>
						<input name="type" value="2" id="fs2" type="radio" checked>
					</div>
				</form>
				<div class="tixian_shuom">
					<p>会员通过实名认证及绑定结算银行卡后，可选择D+1进行结算，结算费率为0；申请成功后，该笔提现会在第二个工作日24:00点之前到账。</p>
					<!--
					<p>同时也可以申请“D+0提现”，结算费率为0，每笔另加2元手续费，申请成功后，该笔营业款会在当日24:00点前到账。</p>
					<p>各通道限额以银行限额为准，以上费率及限额仅供参考，我司保留根据国家政策及第三方支付相关规定进行调整的权利。</p>
				-->
				</div>
			</div>
			<button class="tixian_btn" onclick="submit_tx()">确认</button>
		</div>
	</body>
</html>
{include file="public/footer" /}
<script>
	var member_verif = "{$member_verif['state']}";
	
	if(member_verif!=1){
		layer.msg('请先实名认证！', {
				 time: 1500 
		}, function(){
			location.href="renzhen.html";
		});
	}
	
	
	function submit_tx(){
		
		$('.tixian_btn').attr("disabled",true);
	   var obj = $('input:radio[name="type"]:checked').val();
		var tixian_money =$("#tixian_money").val();
		var yue=$("#yue").text();
		if(tixian_money ==""){
			layer.msg("请输入提现金额");
			$('.tixian_btn').attr("disabled",false);
			return false;
		}
		if(parseInt(tixian_money) > parseInt(yue)){
			layer.msg("余额不足");
			$('.tixian_btn').attr("disabled",false);
			return false;
		}
		
		if(parseFloat(tixian_money)<10){
			layer.msg("提现金额不能小于10元");
			$('.tixian_btn').attr("disabled",false);
			return false;
		}
		
		if(parseFloat(tixian_money)>20000&&obj==2){
			layer.msg("D+1方式提现金额最多可提现20000元");
			$('.tixian_btn').attr("disabled",false);
			return false;
		}
		
		if(parseFloat(tixian_money)>1000&&obj==1){
			layer.msg("D+0方式提现金额不能大于1000元");
			$('.tixian_btn').attr("disabled",false);
			return false;
		}
		$.ajax({
				type:"post",
				url: "{:url('index/member/tixian')}",
				data: {
					//type		: obj,
					balance		: $('#tixian_money').val()
				},
				success: function(data) {
					if(data.code == 200) {
						layer.msg('申请提现成功！', {
						  time: 1500 
						}, function(){
							location.href="index.html";
						});
						
					}else{
						layer.msg(data.msg);
						console.log(data.msg);
					}
				}
			})
		}
	function tx(){	
			var obj = $('input:radio[name="type"]:checked').val();
			var tixian_money=$('#tixian_money').val();//输入金额
			if(obj==1){
				//var shouxufei=(tixian_money*0.0065).toFixed(2);
				var shouxufei = 0;
				$("#shouxufei").text(shouxufei);
				$("#daozhang").text((tixian_money-shouxufei-2).toFixed(2)+"(手续费2元)");
			}else if(obj==2){
				//var shouxufei=(tixian_money*0.006).toFixed(2);
				var shouxufei = 0
				$("#shouxufei").text(shouxufei);
				$("#daozhang").text(tixian_money-shouxufei);
			}
		}
		$("#fs1").click(function(){
			tx();
		});
		$("#fs2").click(function(){
			tx();
		});
</script>

